// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------

import request from '@/libs/request';

/**
 * 获取列表数据
 * @param params
 * @return {*}
 */
export function getPostsListApi(params) {
    return request({
        url: 'crud/posts',
        method: 'get',
        params,
    });
}

/**
 * 获取添加表单数据
 * @return {*}
 */
export function getPostsCreateApi() {
    return request({
        url: 'crud/posts/create',
        method: 'get',
    });
}

/**
 * 添加数据
 * @param data
 * @return {*}
 */
export function postsSaveApi(data) {
    return request({
        url: 'crud/posts',
        method: 'post',
        data
    });
}

/**
 * 添加数据
 * @param data
 * @return {*}
 */
export function postsSaveApiV2(data) {
    return request({
        url: 'crud/posts',
        method: 'post',
        data:data
    });
}

/**
 * 获取编辑表单数据
 * @param id
 * @return {*}
 */
export function getPostsEditApi(id) {
    return request({
        url: `crud/posts/${id}/edit`,
        method: 'get'
    });
}

/**
 * 修改数据
 * @param id
 * @return {*}
 */
export function postsUpdateApi(id, data) {
    return request({
        url: `crud/posts/${id}`,
        method: 'put',
        data
    });
}

/**
 * 修改状态
 * @param id
 * @return {*}
 */
export function postsStatusApi(id, data) {
    return request({
        url: `crud/posts/status/${id}`,
        method: 'put',
        data
    });
}

/**
 * 删除数据
 * @param id
 * @return {*}
 */
export function postsDeleteApi(id) {
    return request({
        url: `crud/posts/${id}`,
        method: 'delete'
    });
}

/**
 * 获取数据
 * @param id
 * @return {*}
 */
export function getPostsReadApi(id) {
    return request({
        url: `crud/posts/${id}`,
        method: 'get'
    });
}


